<?php

include 'common.php';

$ac = in_array($_GET['ac'], array('getcompanylist')) ? $_GET['ac'] : '';

if ($ac == 'getcompanylist') {
    //取得公司列表
    $key = $_GET['key'];
    header("Content-Type:application/json");
    if (!empty($key)) {
        $list = array();
        $query = $_SGLOBAL['db']->query("SELECT name FROM " . Utils::tname('company') . " WHERE name LIKE '$key%' LIMIT 10");
        if ($query) {
            while ($row = $_SGLOBAL['db']->fetchArray($query)) {
                $list[] = $row['name'];
            }
            echo json_encode($list);
        } else {
            echo json_encode(false);
        }
    }
}else{
    //判断用户名是否可用
}
?>
